package com.person.mengshuai.mytestdemo.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.person.mengshuai.mytestdemo.domain.response.Result;
import com.person.mengshuai.mytestdemo.enums.BusinessType;
import com.person.mengshuai.mytestdemo.annotation.DataLog;
import com.person.mengshuai.mytestdemo.entity.BDataLog;
import com.person.mengshuai.mytestdemo.mapper.BDataLogMapper;
import com.person.mengshuai.mytestdemo.service.BDataLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ms
 * @since 2024-08-07
 */
@Service
@Slf4j
public class BDataLogImpl extends ServiceImpl<BDataLogMapper, BDataLog> implements BDataLogService {

    @Override
    @DataLog(desc = "测试全局日志注解是否生效", type = BusinessType.OTHER)
    public Result test(String name, String value) {
        log.info("the method BDataLogImpl test name:{}, value:{}", name, value);
        return Result.success();
    }

    @Override
    @DataLog(desc = "测试全局日志注解post请求是否生效", type = BusinessType.ADD)
    public Result test1(BDataLog bDataLog) {
        log.info("the method BDataLogImpl bDataLog:{}", JSON.toJSONString(bDataLog));
        return Result.success("test1");
    }
}
